<div th:fragment="left">

	<script type="text/javascript" th:inline="javascript">
	var ups = [{id:1, parentId:0,name:"首页",url:"/v2/index"},
	           {id:2, parentId:0,name:"比赛管理",url:""},
			   {id:3, parentId:0,name:"账户管理",url:""},
			   
	           {id:4, parentId:2,name:"比赛列表",url:"/v2/evaluate/list"},
			   {id:5, parentId:3,name:"收款设置",url:"/v2/evaluate/list"},
			   {id:6, parentId:3,name:"修改密码",url:"/v2/evaluate/list"}
	           ];

	var openUrl = function(that, url){
		if(url != null && url!=''){
			location.href=url;
		} else {
			$(that).next().slideToggle(300);
		}
	}
	$(function(){
		$("#menu").loadData({list:ups});
		if(getCookie("menuState")=='close'){
			$(".content").removeClass("close");
			$(".left").css({width: '200px'});
			$(".sold .os").html("收起");
		} else {
			$(".content").addClass("close");	
			$(".left").css({width: '40px' });
			$(".sold .os").html("展开");
		}
		$(".sold .os").click(function(){
			if($(".content").hasClass("close")){
				$(".content").removeClass("close");
				$(".left").animate({width: '200px'});
				$(this).html("收起");
				setCookie("menuState", "close");
			} else {
				$(".content").addClass("close");	
				$(".left").animate({width: '40px' });
				$(this).html("展开");
				setCookie("menuState", "open");
			}
		});
	});
	
	</script>
    <div class="menu">
        <div class="sold">
            <ul class="sold-list">
                <li class="os">展开</li>
            </ul>
        </div>
        <div class="menu-context">
        	<script type="text/template" id="menu">
			#for(data:list)#
			#if(data.parentId==0)#
			<div class="menu-item">
                <div class="menu-title" onclick="openUrl(this, '#{data.url}#')">
					<span class="menu-text">#{data.name}#</span>
					#if(data.url=='')#
					<i class="menu-down"></i>
					#endif#
				</div>
                <ul class="menu-list">
					#for(data2:list)#
						#if(data.id==data2.parentId)#
                    	<li class="" onclick="openUrl(this, '#{data2.url}#')">
							#{data2.name}#
						</li>
						#endif#
					#endfor#
                </ul>
            </div>
			#endif#
			#endfor#
        	</script>
        </div>
    </div>
</div>